package com.jeecg.demo.dao;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Properties;

public class GetPicPath {
	
    private static String url = null;
    private static Properties config = null;
    private GetPicPath() {
    	
    }
    
    static{
    	
    	config=new Properties();
		InputStream ips= GetPicPath.class.getResourceAsStream("/pic_path.properties");
		try {
			config.load(ips);
			if(ips!= null)
	              ips.close();
		} catch (IOException e) {
			//System.out.println("图片路径读取失败");
			e.printStackTrace();
		}
	
    	
    }
    
    public static String getPath(String pathname){
    	
    	url = config.getProperty(pathname);
    	return url;
    }
	public static String readFile(String fileName)
	{   
		String fileContent = "";   
	    try  { 
	    	    
	    		InputStreamReader read = new InputStreamReader(GetPicPath.class.getResourceAsStream(fileName),"UTF-8");     
	    		BufferedReader reader=new BufferedReader(read);     
	    		String line;     
	    		while ((line = reader.readLine()) != null) 
	    		{      
	    			fileContent += line;     
	    		}       
	    		read.close();    
	    	 
	    } catch (Exception e) 
	    {       
	    	e.printStackTrace();   
	    }   
	    return fileContent; 
	} 
}
